<template>
    <div class="todo-panel">
      <div
        class="todo-item"
        v-for="item in list"
        :key="item.name"
      >
        <span class="label">{{ item.name }}</span>
  
        <!-- 进度条 -->
        <div class="bar">
          <span
            class="fill"
            :style="{ width: item.percent + '%', backgroundColor: item.color || '#1890ff' }"
          ></span>
        </div>
  
        <span class="desc">{{ item.desc }}</span>
      </div>
    </div>
  </template>
  
  <script setup>
  defineProps({
    list: {
      type: Array,
      default: () => []
    }
  })
  </script>
  
  <style scoped>
  .todo-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .todo-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #262626;
  }
  
  .label {
    flex: 0 0 60px;
  }
  
  .bar {
    flex: 1;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    margin: 0 12px;
  }
  
  .fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
  }
  
  .desc {
    flex: 0 0 40px;
    text-align: right;
    color: #666;
  }
  </style>